<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: BookmarksController</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">BookmarksController</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/controllers/bookmarks_controller_rb.html">
                app/controllers/bookmarks_controller.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="ApplicationController.html">
                ApplicationController
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000017">auto_complete_for_bookmark_tags</a>&nbsp;&nbsp;
      <a href="#M000015">clear</a>&nbsp;&nbsp;
      <a href="#M000018">create</a>&nbsp;&nbsp;
      <a href="#M000021">destroy</a>&nbsp;&nbsp;
      <a href="#M000019">edit</a>&nbsp;&nbsp;
      <a href="#M000010">index</a>&nbsp;&nbsp;
      <a href="#M000013">list</a>&nbsp;&nbsp;
      <a href="#M000016">new</a>&nbsp;&nbsp;
      <a href="#M000011">return_to_main</a>&nbsp;&nbsp;
      <a href="#M000012">rss</a>&nbsp;&nbsp;
      <a href="#M000014">search</a>&nbsp;&nbsp;
      <a href="#M000020">update</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000017" class="method-detail">
        <a name="M000017"></a>

        <div class="method-heading">
          <a href="#M000017" class="method-signature">
          <span class="method-name">auto_complete_for_bookmark_tags</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000017-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 87</span>
 87:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auto_complete_for_bookmark_tags</span>
 88:         <span class="ruby-identifier">search</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tags</span>]
 89:         <span class="ruby-identifier">searchName</span> = <span class="ruby-identifier">search</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>).<span class="ruby-identifier">last</span>.<span class="ruby-identifier">strip</span>
 90:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">search</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">searchName</span>
 91:                 <span class="ruby-ivar">@searchFirst</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
 92:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">search</span>.<span class="ruby-identifier">split</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">2</span>
 93:                 <span class="ruby-ivar">@searchFirst</span> = <span class="ruby-identifier">search</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">strip</span>
 94:                 <span class="ruby-ivar">@searchFirst</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span>
 95:         <span class="ruby-keyword kw">elsif</span>
 96:                 <span class="ruby-identifier">ssize</span> = ( <span class="ruby-identifier">search</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">searchName</span>.<span class="ruby-identifier">length</span> )
 97:                 <span class="ruby-ivar">@searchFirst</span> = <span class="ruby-identifier">search</span>.<span class="ruby-identifier">first</span>(<span class="ruby-identifier">ssize</span>)
 98:         <span class="ruby-keyword kw">end</span>
 99:           <span class="ruby-ivar">@tags</span> = <span class="ruby-constant">Tag</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;name LIKE '#{searchName}%'&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">search</span>.<span class="ruby-identifier">blank?</span>
100:         <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;livetags&quot;</span> 
101:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000015" class="method-detail">
        <a name="M000015"></a>

        <div class="method-heading">
          <a href="#M000015" class="method-signature">
          <span class="method-name">clear</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000015-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 66</span>
66:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
67:     <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
68:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000018" class="method-detail">
        <a name="M000018"></a>

        <div class="method-heading">
          <a href="#M000018" class="method-signature">
          <span class="method-name">create</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000018-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 103</span>
103:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>
104:     <span class="ruby-ivar">@bookmark</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:bookmark</span>])
105:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@bookmark</span>.<span class="ruby-identifier">save</span>
106:       <span class="ruby-ivar">@bookmark</span>.<span class="ruby-identifier">tag</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tags</span>])
107:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>                                                    
108:         <span class="ruby-ivar">@headers</span>[<span class="ruby-value str">'bookmark-id'</span>] = <span class="ruby-ivar">@bookmark</span>.<span class="ruby-identifier">id</span>
109:         <span class="ruby-ivar">@headers</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'text/html; charset=utf-8'</span>
110:         <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'bookmark'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-identifier">:hidden</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span> }
111:       <span class="ruby-keyword kw">else</span>
112:         <span class="ruby-identifier">return_to_main</span>
113:       <span class="ruby-keyword kw">end</span>
114:     <span class="ruby-keyword kw">else</span>
115:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'form_errors'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">500</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
116:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'new'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
117:     <span class="ruby-keyword kw">end</span>
118:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">destroy</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 137</span>
137:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroy</span>
138:     <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>]).<span class="ruby-identifier">destroy</span>
139:     <span class="ruby-identifier">render</span> <span class="ruby-identifier">:nothing</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
140:     <span class="ruby-identifier">return_to_main</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
141:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">edit</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 120</span>
120:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit</span>
121:     <span class="ruby-ivar">@bookmark</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
122:     <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
123:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="#M000010" class="method-signature">
          <span class="method-name">index</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000010-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 5</span>
 5:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index</span>
 6:         <span class="ruby-identifier">tags_in_cloud</span> = <span class="ruby-identifier">get_setting</span>(<span class="ruby-value str">'tags_in_cloud'</span>)
 7:         <span class="ruby-identifier">tags_in_cloud</span> = <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">tags_in_cloud</span>)
 8:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tags_in_cloud</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
 9:                 <span class="ruby-ivar">@tagged_items</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">tags_count</span>
10:         <span class="ruby-keyword kw">elsif</span>                
11:                         <span class="ruby-ivar">@tagged_items</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">tags_count</span>(<span class="ruby-identifier">:limit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">tags_in_cloud</span>)
12:                 <span class="ruby-keyword kw">end</span>
13:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000013" class="method-detail">
        <a name="M000013"></a>

        <div class="method-heading">
          <a href="#M000013" class="method-signature">
          <span class="method-name">list</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000013-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 32</span>
32:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>
33:         <span class="ruby-identifier">items_per_page</span> = <span class="ruby-identifier">get_setting</span>(<span class="ruby-value str">'bookmarks_per_page'</span>)
34:         <span class="ruby-identifier">items_per_page</span> = <span class="ruby-constant">Integer</span>(<span class="ruby-identifier">items_per_page</span>)
35:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> 
36:         <span class="ruby-ivar">@tags</span> = <span class="ruby-value str">&quot;all&quot;</span>
37:                 <span class="ruby-identifier">page</span> = (<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:page</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_i</span>
38:               <span class="ruby-identifier">offset</span> = (<span class="ruby-identifier">page</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> <span class="ruby-identifier">items_per_page</span>
39:           <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'created_on DESC'</span>
40:           <span class="ruby-ivar">@total_bookmarks</span> = <span class="ruby-ivar">@bookmarks</span>.<span class="ruby-identifier">length</span>
41:           <span class="ruby-ivar">@bookmarks_pages</span> = <span class="ruby-constant">Paginator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-ivar">@bookmarks</span>.<span class="ruby-identifier">length</span>, <span class="ruby-identifier">items_per_page</span>, <span class="ruby-identifier">page</span>)
42:           <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-ivar">@bookmarks</span>[<span class="ruby-identifier">offset</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">offset</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">items_per_page</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)]
43:         <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
44:     <span class="ruby-keyword kw">elsif</span>
45:         <span class="ruby-ivar">@tags</span> = <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>]
46:                 <span class="ruby-identifier">page</span> = (<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:page</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">1</span>).<span class="ruby-identifier">to_i</span>
47:               <span class="ruby-identifier">offset</span> = (<span class="ruby-identifier">page</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> <span class="ruby-identifier">items_per_page</span>
48:           <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find_tagged_with</span>(<span class="ruby-identifier">:any</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>])
49:           <span class="ruby-ivar">@total_bookmarks</span> = <span class="ruby-ivar">@bookmarks</span>.<span class="ruby-identifier">length</span>
50:           <span class="ruby-ivar">@total_bookmarks_tag</span> = <span class="ruby-value str">&quot; tagged '&quot;</span>
51:           <span class="ruby-ivar">@total_bookmarks_tag</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>]
52:           <span class="ruby-ivar">@total_bookmarks_tag</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;'&quot;</span>
53:           <span class="ruby-ivar">@bookmarks_pages</span> = <span class="ruby-constant">Paginator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-ivar">@bookmarks</span>.<span class="ruby-identifier">length</span>, <span class="ruby-identifier">items_per_page</span>, <span class="ruby-identifier">page</span>)
54:           <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-ivar">@bookmarks</span>[<span class="ruby-identifier">offset</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">offset</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">items_per_page</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)]
55:         <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
56:     <span class="ruby-keyword kw">end</span>
57:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000016" class="method-detail">
        <a name="M000016"></a>

        <div class="method-heading">
          <a href="#M000016" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000016-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 70</span>
70:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new</span>
71:     <span class="ruby-ivar">@bookmark</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">new</span>
72:                 <span class="ruby-ivar">@tagged_items</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">tags_count</span>(<span class="ruby-identifier">:limit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>)
73:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
74:       <span class="ruby-ivar">@temp_id</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">to_i</span>
75:       <span class="ruby-ivar">@headers</span>[<span class="ruby-value str">'bookmark-id'</span>] = <span class="ruby-ivar">@temp_id</span>
76:       <span class="ruby-ivar">@headers</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'text/html; charset=utf-8'</span>
77:     
78:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
79:     
80:       <span class="ruby-comment cmt"># If you want to send an error message:</span>
81:       <span class="ruby-comment cmt"># render :inline =&gt; &quot;Error text goes here&quot;, :layout =&gt; false, :status =&gt; 500</span>
82:                 <span class="ruby-keyword kw">elsif</span>
83:     <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'new'</span>
84:     <span class="ruby-keyword kw">end</span>
85:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="#M000011" class="method-signature">
          <span class="method-name">return_to_main</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000011-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 16</span>
16:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">return_to_main</span>
17:     <span class="ruby-comment cmt"># If you have multiple scaffolds on the same view then you will want to change this to</span>
18:     <span class="ruby-comment cmt"># to whatever controller/action shows all the views </span>
19:     <span class="ruby-comment cmt"># (ex: redirect_to :controller =&gt; 'AdminConsole', :action =&gt; 'index')</span>
20:     <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'index'</span>
21:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000012" class="method-detail">
        <a name="M000012"></a>

        <div class="method-heading">
          <a href="#M000012" class="method-signature">
          <span class="method-name">rss</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000012-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 22</span>
22:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rss</span>
23:                 <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> 
24:         <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'created_on DESC'</span>
25:     <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;all&quot;</span> 
26:         <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find</span> <span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'created_on DESC'</span>
27:     <span class="ruby-keyword kw">elsif</span>
28:         <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find_tagged_with</span>(<span class="ruby-identifier">:any</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>])
29:     <span class="ruby-keyword kw">end</span>
30:     <span class="ruby-identifier">render_without_layout</span>
31:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000014" class="method-detail">
        <a name="M000014"></a>

        <div class="method-heading">
          <a href="#M000014" class="method-signature">
          <span class="method-name">search</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000014-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 59</span>
59:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search</span>
60:     <span class="ruby-ivar">@bookmarks</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find_tagged_with</span>(<span class="ruby-identifier">:any</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value str">'tags'</span>])
61:     <span class="ruby-comment cmt">#@bookmarks = Bookmark.find(:all, :conditions =&gt; [&quot;tags LIKE 'tech'&quot;, @params['tags']])</span>
62:     <span class="ruby-ivar">@tagged_items</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">tags_count</span>(<span class="ruby-identifier">:limit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">5</span>)
63:     <span class="ruby-identifier">render</span> <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
64:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">update</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
     <span class="ruby-comment cmt"># File app/controllers/bookmarks_controller.rb, line 125</span>
125:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>
126:     <span class="ruby-ivar">@bookmark</span> = <span class="ruby-constant">Bookmark</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:id</span>])
127:                 <span class="ruby-ivar">@bookmark</span>.<span class="ruby-identifier">tag_names</span>=(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:tags</span>])
128:     <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@bookmark</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-identifier">:bookmark</span>])
129:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'bookmark'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-identifier">:hidden</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
130:       <span class="ruby-identifier">return_to_main</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
131:     <span class="ruby-keyword kw">else</span>
132:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:partial</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'form_errors'</span>, <span class="ruby-identifier">:layout</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">:status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">500</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
133:       <span class="ruby-identifier">render</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'edit'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">xhr?</span>
134:     <span class="ruby-keyword kw">end</span>
135:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>